package com.wyh.common.exception;


import com.wyh.common.enums.ResourceEnum;
import com.wyh.common.enums.ResultCodeEnum;
import io.swagger.annotations.ApiModel;

/**
 * <p>
 *自定义全局异常
 * </p>
 *
 * @author 骸音
 * @since 2024-5-14
 */
@ApiModel("自定义全局异常")
public class CustomException extends RuntimeException {
    private String code;
    private String msg;

    public CustomException(ResultCodeEnum resultCodeEnum) {
        this.code = resultCodeEnum.code;
        this.msg = resultCodeEnum.msg;
    }
    public CustomException(ResourceEnum resourceEnum) {
        this.code = resourceEnum.code;
        this.msg = resourceEnum.msg;
    }

    public CustomException(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
